package kr.kimkisik.middle1math;

import kr.kimkisik.middle1math.danwon.DanwonMain;
import kr.kimkisik.middle1math.gyesan.GyesanMain;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.LayoutAnimationController;
import android.view.animation.TranslateAnimation;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class HelpPage extends Activity {

	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.helpmain);

		ArrayAdapter<CharSequence> Adapter;

		Adapter = ArrayAdapter.createFromResource(this, R.array.listanim,
				R.layout.textcolorview);
		ListView list = (ListView) findViewById(R.id.helplist);
		list.setAdapter(Adapter);

		AnimationSet set = new AnimationSet(true);
		Animation rtl = new TranslateAnimation(Animation.RELATIVE_TO_SELF,
				0.1f, Animation.RELATIVE_TO_SELF, 0.0f,
				Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
				0.0f);

		rtl.setDuration(1000);
		set.addAnimation(rtl);

		Animation alpha = new AlphaAnimation(0.0f, 1.0f);
		alpha.setDuration(1000);
		set.addAnimation(alpha);

		LayoutAnimationController controller = new LayoutAnimationController(
				set, 0.5f);
		list.setLayoutAnimation(controller);

	}

	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	public boolean onOptionsItemSelected(MenuItem item) {
		Intent intent = new Intent();
		switch (item.getItemId()) {
		case R.id.danwonmenu:
			intent.setClass(this, DanwonMain.class);
			startActivity(intent);
			return true;

		case R.id.gyesan:
			intent.setClass(this, GyesanMain.class);
			startActivity(intent);
			return true;

		}
		return false;
	}

}
